Replication of "How Partisan Is Local Election Administration?"

Below, we map each of the tables and figures in the paper to code you can use to reproduce it. The datasets needed to reproduce each table and figure are referenced within these scripts and listed at the bottom of this readme. We specify a project folder directory near the top of most scripts. You will need to specify your working directory for this to work on your machine. Also, many of our scripts draw on one of the Stata commands we wrote specifically for this project. (Find the code for these commands in code/project_commands. Install them by adding them to your personal ado folder. Find the location of this folder by typing "personal" into the Stata command window.) We use these commands to standardize our regression discontinuity plots and tables. We have not validated that these commands will run on all machines, but you should be able to reproduce nearly all of the numerical results in the paper and appendix without relying on these commands. Once you have installed these commands, all scripts below are independent---you do not need to run the first script in order to run the second, etc. Produce the output for any figure or table by running the script it relies on from beginning to end.

Main Tables and Figures:
- Figure 1: /code/descriptives/election_data_map.R
- Figure 2a: /code/descriptives/descriptive_plots_regressions.do
- Figure 2b: /code/descriptives/descriptive_plots_regressions.do
- Figure 3: /code/main_analysis/rd_plots.do
- Table 1: /code/main_analysis/rd_table_elec.do
- Figure 4: /code/main_analysis/rd_over_time_plots.do
- Table 2: /code/policy_analysis/rd_table_turnout_alt.do
- Table 3: /code/mechanisms_analysis/table_term_limited.do
- Figure 5: /code/mechanisms_analysis/rd_plot_mechanisms.do

Appendix Tables and Figures:
- Table A4: /code/descriptives/missing_county_descriptives.do
- Figure A1a: /code/descriptives/pres_clerk_correlation_plots.do
- Figure A1b: /code/descriptives/pres_clerk_correlation_plots.do
- Table A5: /code/validation/rd_table_elec_lag.do
- Table A6: /code/validation/rd_table_covariates.do
- Figure A2: /code/validation/density_test.do
- Table A7: /code/main_analysis/rd_table_elec_simple.do
- Figure A3: /code/validation/rd_bandwidth_sensitivity.do
- Table A8: /code/main_analysis/rd_table_over_time.do
- Table A9: /code/main_analysis/rd_table_tier1.do
- Figure A4: /code/main_analysis/rd_by_state_plots.do
- Table A10: /code/main_analysis/rd_table_over_time.do
- Table A11: /code/main_analysis/rd_table_non_south.do
- Table A12: /code/main_analysis/rd_table_non_vra.do
- Table A13: /code/main_analysis/rd_table_post_shelby.do
- Table A14: /code/main_analysis/rd_table_elec_all.do
- Figure A5a: /code/validation/rd_generalization_plot.do
- Figure A5b: /code/validation/rd_generalization_plot.do
- Table A15: /code/policy_analysis/rd_table_policy.do
- Table A16: /code/policy_analysis/rd_table_policy_county_dem.do
- Table A17: /code/policy_analysis/rd_table_policy_county_rep.do
- Table A18: /code/mechanisms_analysis/rd_table_res_segregation.do
- Figure A6: /code/mechanisms_analysis/rd_plot_segregation.do
- Table A19: /code/mechanisms_analysis/rd_table_diversity.do
- Figure A7: /code/mechanisms_analysis/rd_plot_diversity.do
- Figure A8: /code/mechanisms_analysis/policy_simulation_plots.do
- Table A20: /code/mechanisms_analysis/rd_table_partisan_balance.do
- Figure A9: /code/mechanisms_analysis/rd_plot_partisan_balance.do
- Table A21: /code/mechanisms_analysis/rd_table_large_v_small.do
- Figure A10: /code/mechanisms_analysis/rd_plot_population.do
- Table A22: /code/mechanisms_analysis/rd_table_competition.do
- Figure A11: /code/mechanisms_analysis/rd_plot_competition.do
- Table A23: /code/mechanisms_analysis/rd_table_determinative.do
- Figure A12: /code/mechanisms_analysis/rd_plot_determinative.do
- Table A24: /code/policy_analysis/rd_table_polling_places.do
- Table A25: /code/policy_analysis/rd_table_provisionals.do
- Table A26: /code/policy_analysis/rd_table_provisional_rejections.do
- Table A27: /code/policy_analysis/rd_table_absentee_rejections.do
- Table A28: /code/policy_analysis/rd_table_registration.do
- Table A29: /code/policy_analysis/rd_table_reg_removal.do
- Table A30: /code/policy_analysis/rd_table_dem_registration.do
- Table A31: /code/policy_analysis/rd_table_wait_times.do
- Table A32: /code/policy_analysis/rd_table_wait_times_10.do
- Table A33: /code/policy_analysis/rd_table_wait_times_chen.do
- Table A34: /code/policy_analysis/rd_table_wait_times_chen_disp.do


Datasets
- counties_not_in_scope.dta: a list of the counties that are not in scope for the analysis for various reasons described in the paper
- county_demographics.dta: demographic data for nearly all US counties over time, mostly drawn from census data
county_map_data.dta
- did_election_analysis_data.dta: data prepared for panel analyses
- elec_did_data.dta: county clerk election data stored in a panel format
- elec_rd_data.dta: county clerk election data prepared for the regression discontinuity design
- rd_election_analysis_data.dta: data prepared for the regression discontinuity analyses of effects on election results
- rd_reg_turnout_analysis_data.dta: data prepared for the regression discontinuity analyses of effects on participation and policy
- state_abbrev.dta: a mapping of state names to state name abbreviations
